Skip to content

fix(visitor): check type for the underlying js object#684

Merged
devongovett merged 1 commit intoparcel-bundler:masterfrom
kwonoj:fix-transformer-visitor
Feb 27, 2024
Merged

fix(visitor): check type for the underlying js object#684
devongovett merged 1 commit intoparcel-bundler:masterfrom
kwonoj:fix-transformer-visitor

Conversation

@kwonoj
Copy link
Contributor

@kwonoj kwonoj commented Feb 27, 2024

This PR aims to make a stopgap workaround for napi-rs/napi-rs#1641.

TL:DR, with latest napi get_named_property's Result does not ensure if it's correct type of the value or not. It can be null|undefined, causes a failure later.

PR guards for the custom visitor logic to look up each properties - check its value type, then coerce into actual value. If upstream napi fixes this behavior it can go away, but anyone uses napi version ~today can benefit by this changes still.

Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@devongovett devongovett merged commit bdf4a77 into parcel-bundler:master Feb 27, 2024
@kwonoj kwonoj deleted the fix-transformer-visitor branch February 27, 2024 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants